function frames = make_datamovie(data)
% Record dynamic data movie

hfig = figure;

allX = [data{:}];
xmin = min(allX(1,:));
xmax = max(allX(1,:));
ymin = min(allX(2,:));
ymax = max(allX(2,:));

argn = [xmin - (xmax-xmin)*0.1, ...
    xmax + (xmax-xmin)*0.1, ...
    ymin - (ymax-ymin)*0.1, ...
    ymax + (ymax-ymin)*0.1];


set(gca,'nextplot','replacechildren');

for i = 1 : numel(data)
    X = data{i};
    plot(X(1,:), X(2,:), '.', 'MarkerSize', 3);
    
    axis equal;
    axis(argn);    
    set(gca, 'XTick', [], 'YTick', []);
    
    frames(i) = getframe;  %#ok<AGROW>
end

close(hfig);